- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8
 
Use contiguous memory layout for neighbor lists #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
          Codecov Report❌ Patch coverage is  
 Additional details and impacted files@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
- Coverage   86.94%   84.76%   -2.19%     
==========================================
  Files          15       15              
  Lines         659      689      +30     
==========================================
+ Hits          573      584      +11     
- Misses         86      105      +19     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
87d232f    to
    4fbd32d      
    Compare
  
    4fbd32d    to
    eedc1e3      
    Compare
  
    2209334    to
    69646c3      
    Compare
  
    69646c3    to
    ce9153f      
    Compare
  
    09f5a6a    to
    6212b13      
    Compare
  
    45ddfb2    to
    447f42b      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for using Vector{Vector} as a backend for PrecomputedNeighborhoodSearch, making it more flexible and memory-efficient for certain use cases. It also introduces a freeze_neighborhood_search function to strip unnecessary data structures when preparing neighborhood searches for GPU execution.
- Refactored 
PrecomputedNeighborhoodSearchto support configurable backends (DynamicVectorOfVectorsorVector{Vector}) - Added 
freeze_neighborhood_searchto optimize GPU transfers by removing internal neighborhood searches - Introduced 
max_inner_lengthhelper function to handle backend-specific configuration copying 
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description | 
|---|---|
| src/nhs_precomputed.jl | Refactored struct to support configurable backends, added freeze_neighborhood_search implementation | 
| src/vector_of_vectors.jl | Added max_inner_length helper for extracting backend configuration | 
| src/neighborhood_search.jl | Added generic freeze_neighborhood_search interface | 
| src/gpu.jl | Updated GPU adaptation to handle PrecomputedNeighborhoodSearch instead of GridNeighborhoodSearch | 
| src/cell_lists/spatial_hashing.jl | Fixed trailing whitespace in documentation | 
| src/cell_lists/full_grid.jl | Updated documentation and replaced max_points_per_cell with max_inner_length | 
| benchmarks/smoothed_particle_hydrodynamics.jl | Added freeze_neighborhood_search call before GPU transfer | 
| benchmarks/n_body.jl | Added freeze_neighborhood_search call before GPU transfer | 
| benchmarks/run_benchmarks.jl | Added PrecomputedNeighborhoodSearch to GPU benchmark suite | 
| test/neighborhood_search.jl | Added test cases for PrecomputedNeighborhoodSearch with Vector{Vector} backend | 
Comments suppressed due to low confidence (1)
src/nhs_precomputed.jl:128
- The element type 
Int[]should be consistent with the backend type. When usingVector{Vector{Int32}}backend, this createsVector{Int}elements instead ofVector{Int32}, which is inconsistent. Consider using the element type from the backend or making this type-stable. 
        neighbor_lists[i] = Int[]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - `Vector{Vector{Int32}}`: Scattered memory, but very memory-efficient. | ||
| - `DynamicVectorOfVectors{Int32}`: Contiguous memory, optimizing cache-hits. | ||
| - `DynamicVectorOfVectors{Int32}`: Contiguous memory, optimizing cache-hits | ||
| and GPU compatible. | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatical inconsistency: 'GPU compatible' should be 'GPU-compatible' to match the hyphenation style used in the PrecomputedNeighborhoodSearch documentation.
| and GPU compatible. | |
| and GPU-compatible. | 
Based on #111.